<%--房屋审核--%>

<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <link rel="stylesheet" href="/static/base/common/css/sapar.css"/>
    <link rel="stylesheet" href="/static/base/static/css/index_inner.css"/>
    <link rel="stylesheet" type="text/css" href="/static/webjars/layui/css/layui.css" media="all"/>
    <link rel="stylesheet" type="text/css" href="/static/webjars/layui/css/modules/layer/default/layer.css" media="all">
    <title>居民与房屋管理-主页</title>
    <style type="text/css">
        .red{
            border: 1px red solid;
        }

    </style>
</head>

<body>
<div id="container" style="width: 98%;margin: 0 auto" >
    <table class="layui-table" id="houseApproval" lay-filter="houseApproval" ></table>

</div>


<script type="text/html" id="barDemo">
    <button class="layui-btn layui-btn-xs " lay-event="detail">详细</button>
    <button class="layui-btn layui-btn-xs" lay-event="pass">批准</button>
    <button class="layui-btn layui-btn-danger layui-btn-xs " lay-event="refuse">拒绝</button>
</script>
</body>



<script type="text/javascript" src="/static/webjars/layui/layui.all.js"></script>
<script type="text/javascript" src="/static/base/common/js/jquery.js"></script>
<script type="text/javascript" src="/static/base/common/js/sapar.js"></script>
<script type="text/javascript" src="/static/base/static/js/index_inner.js"></script>
<script>
    layui.use(['table'], function(){
        var form = layui.form
            ,table = layui.table
            ,layer = layui.layer
            ,$ = layui.$;
        var limitNum = 15;
        var limitNums = [15,30,45,60,75,90]

        table.render({
            elem: '#houseApproval'
            ,height: 600
            ,url: '/ajax/search/gethouseinfo-limit'
            ,limit: limitNum
            ,limits: limitNums
            ,page: { //支持传入 laypage 组件的所有参数（某些参数除外，如：jump/elem） - 详见文档
                layout: ['limit', 'count', 'prev', 'page', 'next', 'skip'] //自定义分页布局
                //,curr: 5 //设定初始在第 5 页
                ,groups: 1 //只显示 1 个连续页码
                ,first: false //不显示首页
                ,last: false //不显示尾页
            }
            ,method: 'post'
            ,request: {
                pageName: 'limitPage' //页码的参数名称，默认：page
                ,limitName: 'limitNum' //每页数据量的参数名，默认：limit
            }
            ,response: {
                statusName: 'res' //数据状态的字段名称，默认：code
                ,statusCode: 1 //成功的状态码，默认：0
                ,msgName: 'code' //状态信息的字段名称，默认：msg
                ,countName: 'count' //数据总数的字段名称，默认：count
                ,dataName: 'data' //数据列表的字段名称，默认：data
            }
            ,cols: [[ //表头
                {field: 'id', title:'ID', width: 80,fixed:'left'}
                ,{field: 'name', width:100, title: '业主姓名'}
                ,{field: 'tellphone',width: 150, title: '业主联系电话'}
                ,{field: 'address', title: '地址',templet: function(d){
                        return d.province+ d.city +d.county+ d.town+ d.village+ d.address;
                    }}
                ,{field: 'uploadName',width: 100, title: '网格员姓名'}
                ,{field: 'updateTime', width:200, title: '上传日期'}
                ,{field: 'status', title: '状态',width: 100
                    ,templet: function(d){
                    if(d.status === 0){
                        return "<span style='color: lightseagreen;'>待审核</span>";
                    }else if(d.status === 1){
                        return "<span style='color: dodgerblue;'>已审核</span>";
                    }else if(d.status === -1){
                        return "<span style='color: red;'>已拒绝</span>";
                    }

                }}
                ,{title:'操作',fixed: 'right',width: 200, toolbar: '#barDemo'}

            ]]
        });

        table.on('tool(houseApproval)', function(obj){
            var data = obj.data;
            if(obj.event === 'detail'){
                window.open("/house/ProprietorDetails?id="+data.id);
            } else if(obj.event === 'pass'){
                $.post("/ajax/save/houseinfo-status",{
                    id:data.id
                },function(result){
                    if(result.res === "1"){
                        layer.msg("通过");
                        setTimeout(function(){
                            window.location.reload();
                        },1000);
                    }
                });

            } else if(obj.event === 'refuse'){
                $.post("/ajax/save/houseinfo-deny",{
                    id:data.id
                },function(result){
                    if(result.res === "1"){
                        layer.msg("已拒绝");
                        setTimeout(function(){
                            window.location.reload();
                        },1000);
                    }
                });
            }
        });





    });
</script>



</html>
